<script>
    function myform_submit() {
        if($("#siteId").val() == ''){
            alert('请选择维修站点');
            return false;
        }
        if($("#categoryId").val() == ''){
            alert('请选择产品类型');
            return false;
        }
        if($("#customerId").val() == ''){
            alert('请选择需要自定义费用的客户');
            return false;
        }
        return true;
    }
    //列表
    $(function(){
        $("select").change(function(){
            $.post("<?=blang_url('common/Com_ajax/laborPrice')?>/",$("#formData select").serialize(), function(data){
                    $('#priceConten').html(data);
                }
            );
            console.info($("#formData select").serialize());
        });
        $("select[data-edit-select]").filterSelect();
    })
</script>


<!--菜单 start-->
<?php $this->load->view('defaults/common/left');?>
<!--菜单 end-->
<div id="content">
    <div class="page-header">
        <div class="container-fluid">
          <h1><?=lang('menu_yhgl')?></h1>
          <?=$this->breadcrumb->generateHTML();?>
        </div>
    </div>
    <div class="container-fluid">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-plus"></i>增加自定义费用</h3>
          </div>
          <div class="panel-body">
            <form class="form-horizontal" action="<?=blang_url('users/CustomerPrice/'.$post_type)?>" method="post" name="formData" id="formData" onsubmit="return myform_submit()" autocomplete="off" >
                <div class="form-group">
                    <label class="col-sm-2 control-label"><label class="red">*</label>维修站点</label>
                    <div class="col-sm-10">
                        <select class="form-control getLabor" name="site_id" id="siteId">
                            <option value="" >--请选择--</option>
                            <?php foreach ($serviceCenterList as $rs):?>
                                <option value="<?=$rs['id']?>" <?=$optSite[$rs['id']]?> >
                                    <?=$rs['name_ch']?>
                                </option>
                            <?php endforeach;?>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><label class="red">*</label>产品类型</label>
                    <div class="col-sm-10">
                       <select name="category_id" id="categoryId" class="form-control getLabor">
                            <option value="" >--请选择--</option>
                            <?php foreach ($categoryList as $rs):?>
                                <option value="<?=$rs['id']?>" <?=$optCategory[$rs['id']]?> >
                                    <?=$rs['name_ch']?>
                                </option>
                            <?php endforeach;?>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><label class="red">*</label>客户</label>
                    <div class="col-sm-10">
                        <select name="customer_id" id="customerId" class="form-control getLabor" data-edit-select="1">
                            <option value="" >--请选择--</option>
                            <?php foreach ($customerList as $rs):?>
                                <option value="<?=$rs['id']?>" <?=$optCustomer[$rs['id']]?> > <?=$rs['name']?> </option>
                            <?php endforeach;?>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">维修级别</label>
                    <div class="col-sm-10">
                       <select name="grade" id="gradeId" class="form-control getLabor">
                            <option value="" >--请选择--</option>
                            <?php foreach ($gradeList as $rs):?>
                                <option value="<?=$rs['id']?>" <?=$optGrade[$rs['id']]?> >
                                    <?=$rs['name_ch']?>
                                </option>
                            <?php endforeach;?>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">品牌</label>
                    <div class="col-sm-10">
                       <select name="brand_id" id="brandId" class="form-control getLabor" data-edit-select="1">
                            <option value="" >--请选择--</option>
                            <?php foreach ($brandList as $rs):?>
                                <option value="<?=$rs['id']?>" <?=$optBrand[$rs['id']]?> > <?=$rs['name']?> </option>
                            <?php endforeach;?>
                        </select>
                    </div>
                </div>
                <div style="background: #E8ECF1;" id="priceConten">
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-10">
                       <input class="btn btn-primary" style="padding:8px 45px;" type="submit" value="<?=lang('public_tj')?>" name="submits" />
                    </div>
                </div>
            </form>
          </div>
        </div>
    </div>
  <style>
    #priceConten label {font-size: 12px; width: 215px; display: inline-block; text-align: right; line-height: 15px; height: 28px; font-weight: normal;}
    #priceConten {padding:10px 0px;}
  </style>
</div>
